/*
Description

We have a piece of cardboard square, side length is n cm. We use it to make a cuboid cup(The five side is paper, one side is empty):

_____________________________
|                           |
|                           |
|                           |
|                           |
|                           |
|                           |
|                           |
|___________________________|
First we need to cut four identical small squares in the four corners of the cardboard.

           _______________
      cut  |             |  cut
     ______|             |______
    |                           |
    |                           |
    |                           |
    |______              _______|
           |             |
      cut  |_____________|  cut
Then the four protruding part is folded upwards, a rectangular cup is made.

We can assume that the length of the small square is an integer. Please calculate, how much is the maximum volume of the cup we made?

Task

Complete function maximumVolume() that accepts a arguments n(a positive integer more than 4). Returns a positive integer that is the side length of the small square.

Example

maximumVolume(5)  === 9
3 * 3 * 1 = 9
maximumVolume(6)  === 16
4 * 4 * 1 = 16
maximumVolume(7)  === 25
5 * 5 * 1 = 25
maximumVolume(8)  === 36
6 * 6 * 1 = 36
maximumVolume(9)  === 50
5 * 5 * 2 = 50
maximumVolume(10)  === 72
6 * 6 * 2 = 72
maximumVolume(20)  === 588
14 * 14 * 3 = 588

*/

function maximumVolume(n) {
    let vs = [];
    for (let i = 1; ; i++) {
        let inner = n - 2 * i;
        if (inner <= 0) {
            break;
        } else {
            vs.push(inner * inner * i)
        }
    }
    return Math.max.apply(Math, vs);
}
